package com.dragon.system.service.impl;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.dragon.common.core.domain.entity.SysDictData;
import com.dragon.common.core.domain.entity.SysUser;
import com.dragon.common.utils.ECYUtils;
import com.dragon.common.utils.ShiroUtils;
import com.dragon.system.domain.DoubleBill;
import com.dragon.system.domain.ECYAo;
import com.dragon.system.domain.ECYVo;
import com.dragon.system.domain.EventHedgeProfitsDoubleToSingle;
import com.dragon.system.domain.EventPlateDoubleToOneDetailInfos;
import com.dragon.system.domain.SizeBill;
import com.dragon.system.mapper.ManagerMapper;
import com.dragon.system.service.IManagerService;
import com.dragon.system.service.ISysDictDataService;

@Service
public class ManagerServiceImpl implements IManagerService
{
    @Autowired
    private ManagerMapper managerMapper;
    @Autowired
    private ISysDictDataService dictDataService;

	@Override
	public List<SizeBill> selectSizeList() {
		return managerMapper.selectSizeList();
	}

	@Override
	public List<String> selectHgTeamList() {
		return managerMapper.selectHgTeamList();
	}

	@Override
	public List<JSONObject> select500ToHgList() {
		return managerMapper.select500ToHgList();
	}

	@Override
	public int select500ToHgAdd(String[] teamList) {
		if(teamList==null||teamList.length<1) return 0;
		String key = "sys_team_name";
		int result = 0;
		SysUser user = ShiroUtils.getSysUser();
		for(int i=0; i<teamList.length; i++) {
			JSONObject teamJSON = JSONObject.parseObject(teamList[i]);
			SysDictData data = teamJSON.toJavaObject(SysDictData.class);
			if(data.getDictLabel()==null||data.getDictLabel().isEmpty()) continue;
			if(data.getDictValue()==null||data.getDictValue().isEmpty()) continue;
			if(!key.equals(data.getDictType())) continue;
			data.setCreateBy(user.getLoginName());
			dictDataService.insertDictData(data);
			result++;
		}
		return result;
	}

	@Override
	public List<ECYVo> getECYList(ECYAo ecy) {
		List<ECYVo> results = new ArrayList<>();
		results.add(getECYVo(ecy, 0));
		results.add(getECYVo(ecy, 1));
		if(ecy.getOriginOddsFlat1()!=null&&!"生死2".equals(ecy.getKind1())) results.add(getECYVo(ecy, 2));
		results.add(getECYVo(ecy, 3));
		if(ecy.getOriginOddsFlat2()!=null&&!"生死2".equals(ecy.getKind2())) results.add(getECYVo(ecy, 4));
		return results;
	}
	
	/**
	 * 
	 * @param ecy 计算参数
	 * @param type 计算类型【0-竞彩二串一】【1-第1场外盘】【2-第1场平局】【3-第2场外盘】【4-第2场平局】
	 * @return
	 */
	private static ECYVo getECYVo(ECYAo ecy,Integer type) {
		ECYVo result = new ECYVo();
		result.setBetMoney(getBetMoney(ecy, type));
		Double hgRtnWater = ecy.getPeripheryRtnWater();
		if(type==0) {
			result.setName("竞彩二串一");
			result.setOdds(getJCECYOdds(ecy.getOriginOddsWinLose1(), ecy.getOriginOddsWinLose2()));
			result.setOddsMixed(getJCMixOdds(result.getOdds(), ecy.getProfitAdjust()));
			result.setRtnWater(ecy.getLotteryRtnWater());
			result.setReword(result.getBetMoney()*result.getOddsMixed());
			result.setFlatRtn(0d);
			result.setLotteryRtn(result.getBetMoney()*result.getRtnWater());
			result.setPeriphery1Rtn(getBetMoney(ecy, 1)*hgRtnWater+getBetMoney(ecy, 2)*hgRtnWater);
			result.setPeriphery2Rtn(getBetMoney(ecy, 3)*hgRtnWater+getBetMoney(ecy, 4)*hgRtnWater);
			result.setTotalExpense(result.getBetMoney()+getBetMoney(ecy, 1)+getBetMoney(ecy, 2)+getBetMoney(ecy, 3)+getBetMoney(ecy, 4));
		}else if(type==1) {
			result.setName("第1场外盘");
			result.setOdds(ecy.getOriginOddsPeriphery1());
			result.setOddsMixed(getHGMixOdds(result.getOdds(), hgRtnWater));
			result.setRtnWater(hgRtnWater);
			result.setReword(result.getOdds()*result.getBetMoney());
			result.setFlatRtn(0d);
			result.setLotteryRtn(getBetMoney(ecy, 0)*ecy.getLotteryRtnWater());
			result.setPeriphery1Rtn(getBetMoney(ecy, 1)*ecy.getPeripheryRtnWater()*(result.getOdds()-1)+getBetMoney(ecy, 2)*ecy.getPeripheryRtnWater());
			result.setPeriphery2Rtn(0d);
			result.setTotalExpense(result.getBetMoney()+getBetMoney(ecy, 0)+getBetMoney(ecy, 2));
		}else if(type==2) {
			result.setName("第1场平局");
			result.setOdds(ecy.getOriginOddsFlat1());
			result.setOddsMixed(getHGMixOdds(result.getOdds(), hgRtnWater));
			result.setRtnWater(hgRtnWater);
			result.setReword(result.getOdds()*result.getBetMoney());
			result.setFlatRtn(getBetMoney(ecy, 1)*ECYUtils.TIEODDS(ecy.getKind1(), ecy.getOriginOddsPeriphery1()));
			result.setLotteryRtn(getBetMoney(ecy, 0)*ecy.getLotteryRtnWater());
			result.setPeriphery1Rtn(getBetMoney(ecy, 1)*ecy.getPeripheryRtnWater()*ECYUtils.TIEODDS(ecy.getKind1(), ecy.getOriginOddsPeriphery1())+getBetMoney(ecy, 2)*ecy.getPeripheryRtnWater()*(result.getOdds()-1));
			result.setPeriphery2Rtn(0d);
			result.setTotalExpense(result.getBetMoney()+getBetMoney(ecy, 0)+getBetMoney(ecy, 1));
		}else if(type==3) {
			result.setName("第2场外盘");
			result.setOdds(ecy.getOriginOddsPeriphery2());
			result.setOddsMixed(getHGMixOdds(result.getOdds(), hgRtnWater));
			result.setRtnWater(hgRtnWater);
			result.setReword(result.getOdds()*result.getBetMoney());
			result.setFlatRtn(0d);
			result.setLotteryRtn(getBetMoney(ecy, 0)*ecy.getLotteryRtnWater());
			result.setPeriphery1Rtn(getBetMoney(ecy, 1)*hgRtnWater+getBetMoney(ecy, 2)*hgRtnWater);
			result.setPeriphery2Rtn(getBetMoney(ecy, 3)*hgRtnWater*(result.getOdds()-1)+getBetMoney(ecy, 4)*hgRtnWater);
			result.setTotalExpense(result.getBetMoney()+getBetMoney(ecy, 1)+getBetMoney(ecy, 2)+getBetMoney(ecy, 0)+getBetMoney(ecy, 4));
		}else if(type==4) {
			result.setName("第2场平局");
			result.setOdds(ecy.getOriginOddsFlat2());
			result.setOddsMixed(getHGMixOdds(result.getOdds(), hgRtnWater));
			result.setRtnWater(hgRtnWater);
			result.setReword(result.getOdds()*result.getBetMoney());
			result.setFlatRtn(getBetMoney(ecy, 3)*ECYUtils.TIEODDS(ecy.getKind2(), ecy.getOriginOddsPeriphery2()));
			result.setLotteryRtn(getBetMoney(ecy, 0)*ecy.getLotteryRtnWater());
			result.setPeriphery1Rtn(getBetMoney(ecy, 1)*hgRtnWater+getBetMoney(ecy, 2)*hgRtnWater);
			result.setPeriphery2Rtn(getBetMoney(ecy, 4)*hgRtnWater*(result.getOdds()-1)+getBetMoney(ecy, 3)*hgRtnWater*ECYUtils.TIEREBATE(ecy.getKind2(), ecy.getOriginOddsPeriphery2()));
			result.setTotalExpense(result.getBetMoney()+getBetMoney(ecy, 1)+getBetMoney(ecy, 2)+getBetMoney(ecy, 3)+getBetMoney(ecy, 0));
		}
		result.setTotalIncome(result.getReword()+result.getFlatRtn()+result.getLotteryRtn()+result.getPeriphery1Rtn()+result.getPeriphery2Rtn());
		result.setTotalProfit(result.getTotalIncome()-result.getTotalExpense());
		result.setProfitPercent(result.getTotalProfit()/result.getBetMoney());
		return result;
	}
	
	private static Double getJCECYOdds(Double odds1, Double odds2) {
		Double odds = odds1*odds2*2;
		BigDecimal b = new BigDecimal(String.valueOf(odds));  
		odds = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		return odds/2;
	}
	
	private static Double getJCMixOdds(Double odds, Double profitAdjust) {
		Double result = odds*(1+profitAdjust/100);
		return result;
	}
	
	private static Double getHGMixOdds(Double odds, Double rtnWater) {
		Double result = odds*(1+rtnWater)-2*rtnWater;
		return result;
	}
	
	/**
	 * 
	 * @param ecy
	 * @param type 计算类型【0-竞彩二串一】【1-第1场外盘】【2-第1场平局】【3-第2场外盘】【4-第2场平局】
	 * @return
	 */
	private static Double getBetMoney(ECYAo ecy,Integer type) {
		Double result = 0d;
		if(type==0) {
			result = ecy.getBetMoneyWinLose();
		}else if(type==1) {
			result = ecy.getBetMoneyWinLose()*(1-ecy.getLotteryRtnWater()+ecy.getProfitAdjust()/100);
			Double param1 = getHGMixOdds(ecy.getOriginOddsPeriphery1(), ecy.getPeripheryRtnWater())+ecy.getPeripheryRtnWater()-1;
			Double param2 = 0d;
			if(ecy.getOriginOddsFlat1()!=null) param2 = (ecy.getPeripheryRtnWater()-1)*ECYUtils.MIXTIEODDS(ecy.getKind1(), getHGMixOdds(ecy.getOriginOddsPeriphery1(), ecy.getPeripheryRtnWater()), ecy.getPeripheryRtnWater())/getHGMixOdds(ecy.getOriginOddsFlat1(), ecy.getPeripheryRtnWater());
			result = result/(param1+param2);
			if(result<0d) result = 0d;
		}else if(type==2) {
			if(ecy.getOriginOddsFlat1()!=null) result = getBetMoney(ecy, 1)*ECYUtils.MIXTIEODDS(ecy.getKind1(), getHGMixOdds(ecy.getOriginOddsPeriphery1(), ecy.getPeripheryRtnWater()), ecy.getPeripheryRtnWater())/getHGMixOdds(ecy.getOriginOddsFlat1(), ecy.getPeripheryRtnWater());
		}else if(type==3) {
			result = getBetMoney(ecy, 0)*getJCMixOdds(getJCECYOdds(ecy.getOriginOddsWinLose1(), ecy.getOriginOddsWinLose2()), ecy.getProfitAdjust())/getHGMixOdds(ecy.getOriginOddsPeriphery2(), ecy.getPeripheryRtnWater());
		}else if(type==4) {
			if(ecy.getOriginOddsFlat2()!=null) result = getBetMoney(ecy, 3)*ECYUtils.MIXTIEODDS(ecy.getKind2(), getHGMixOdds(ecy.getOriginOddsPeriphery2(), ecy.getPeripheryRtnWater()), ecy.getPeripheryRtnWater())/getHGMixOdds(ecy.getOriginOddsFlat2(), ecy.getPeripheryRtnWater());
		}
		return result;
	}

	@Override
	public List<DoubleBill> selectDoubleList() {
		List<DoubleBill> doubleBills = managerMapper.selectDoubleList();
		if(doubleBills==null) return doubleBills;
		String[] types = new String[] {"生死1", "生死2", "生死平", "平手1", "平手2", "平手3", "赢半1", "赢半2", "赢半3", "输半1", "输半2", "输半3"};
		List<DoubleBill> results = new ArrayList<>();
		for(int j=0; j<doubleBills.size(); j++) {
			List<EventHedgeProfitsDoubleToSingle> EventHedgeProfitsDoubleToSingles = new ArrayList<>();
			for(int i=0; i<types.length; i++) {
				List<EventHedgeProfitsDoubleToSingle> EventHedgeProfitsDoubleToSingle=null;
				if(types[i].equals("生死1")) {
					EventHedgeProfitsDoubleToSingle = getSsOne(doubleBills.get(j));
				}else if(types[i].equals("生死2")) {
					EventHedgeProfitsDoubleToSingle = getSsTwo(doubleBills.get(j));
				}else if(types[i].equals("生死平")) {
					EventHedgeProfitsDoubleToSingle = getSsp(doubleBills.get(j));
				}else if(types[i].equals("平手1")) {
					EventHedgeProfitsDoubleToSingle = getPsOne(doubleBills.get(j));
				}else if(types[i].equals("平手2")) {
					
				}else if(types[i].equals("平手3")) {
					EventHedgeProfitsDoubleToSingle = getPsThree(doubleBills.get(j));
				}else if(types[i].equals("赢半1")) {
					EventHedgeProfitsDoubleToSingle = getYbOne(doubleBills.get(j));
				}else if(types[i].equals("赢半2")) {
					
				}else if(types[i].equals("赢半3")) {
					EventHedgeProfitsDoubleToSingle = getYbThree(doubleBills.get(j));
				}else if(types[i].equals("输半1")) {
					EventHedgeProfitsDoubleToSingle = getSbOne(doubleBills.get(j));
				}else if(types[i].equals("输半2")) {
					
				}else if(types[i].equals("输半3")) {
					EventHedgeProfitsDoubleToSingle = getSbThree(doubleBills.get(j));
				}
				if(EventHedgeProfitsDoubleToSingle!=null&&EventHedgeProfitsDoubleToSingle.size()>0) EventHedgeProfitsDoubleToSingles.addAll(EventHedgeProfitsDoubleToSingle);
			}
			if(EventHedgeProfitsDoubleToSingles.size()==0) continue;
			List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = getPlateTitle(doubleBills.get(j));
			EventPlateDoubleToOneDetailInfos.addAll(doubleBills.get(j).getEventPlateDoubleToOneDetailInfos());
			doubleBills.get(j).setEventPlateDoubleToOneDetailInfos(EventPlateDoubleToOneDetailInfos);
			doubleBills.get(j).setEventHedgeProfitsDoubleToSingle(EventHedgeProfitsDoubleToSingles);
			results.add(doubleBills.get(j));
		}
		return results;
	}
	
	private static List<EventPlateDoubleToOneDetailInfos> getPlateTitle(DoubleBill doubleBill) {
		List<EventPlateDoubleToOneDetailInfos> results = new ArrayList<>();
		EventPlateDoubleToOneDetailInfos result = new EventPlateDoubleToOneDetailInfos();
		result.setFlatWater("平局");
		result.setHomeFieldWater(doubleBill.getHomeField());
		result.setOpponentFieldWater(doubleBill.getOpponentField());
		result.setPlate("盘口");
		result.setWebsite(doubleBill.getLeagueName());
		results.add(result);
		return results;
	}
	
	public static Double getRewordReturn(Double jcOdds, String type, Double hgOdds, Double flatOdds) {
		return 1/(1/jcOdds+1/ECYUtils.CASINOODDS(type, hgOdds, flatOdds));
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getSbThree(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai0=null;
		EventPlateDoubleToOneDetailInfos hg005=null;
		EventPlateDoubleToOneDetailInfos hg051=null;
		EventPlateDoubleToOneDetailInfos jsq1=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0/0.5")) {
				hg005 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5/1")) {
				hg051 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("净1")) {
				jsq1 = odds;
			}
		}
		if(jingcai1==null&&jingcai0==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai1!=null&&hg051!=null&&jsq1!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg051.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jsq1.getHomeFieldWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("输半3");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+jsq1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg051.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai0!=null&&hg005!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai0.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg005.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai0.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("输半3");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg005.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getSbOne(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai0=null;
		EventPlateDoubleToOneDetailInfos hg005=null;
		EventPlateDoubleToOneDetailInfos hg051=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0/0.5")) {
				hg005 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5/1")) {
				hg051 = odds;
			}
		}
		if(jingcai1==null&&jingcai0==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai1!=null&&hg051!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg051.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("输半1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg051.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai0!=null&&hg005!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai0.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg005.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai0.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("输半1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg005.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getYbThree(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai0=null;
		EventPlateDoubleToOneDetailInfos hg005=null;
		EventPlateDoubleToOneDetailInfos hg051=null;
		EventPlateDoubleToOneDetailInfos hg151=null;
		EventPlateDoubleToOneDetailInfos jsp1=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0/0.5")) {
				hg005 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5/1")) {
				hg051 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("1/1.5")) {
				hg151 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("净1")) {
				jsp1 = odds;
			}
		}
		if(jingcai1==null&&jingcai0==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai1!=null&&jsp1!=null&&hg051!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg051.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jsp1.getHomeFieldWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半3");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+jsp1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg051.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai1!=null&&jsp1!=null&&hg151!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg151.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jsp1.getHomeFieldWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半3");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+jsp1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg151.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai0!=null&&hg005!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai0.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg005.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai0.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半3");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg005.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getYbOne(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai0=null;
		EventPlateDoubleToOneDetailInfos hg005=null;
		EventPlateDoubleToOneDetailInfos hg051=null;
		EventPlateDoubleToOneDetailInfos hg115=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0/0.5")) {
				hg005 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5/1")) {
				hg051 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("1/1.5")) {
				hg115 = odds;
			}
		}
		if(jingcai1==null&&jingcai0==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai1!=null&&hg115!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg115.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg115.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai0!=null&&hg005!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai0.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg005.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai0.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai0.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg005.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai1!=null&&hg051!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg051.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("赢半1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg051.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getSsp(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai2=null;
		EventPlateDoubleToOneDetailInfos jsq1=null;
		EventPlateDoubleToOneDetailInfos hg00=null;
		EventPlateDoubleToOneDetailInfos hg05=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai2 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("净1")) {
				jsq1 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0**")) {
				hg00 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5")) {
				hg05 = odds;
			}
		}
		if(jingcai1==null&&jingcai2==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai2!=null&&hg00!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai2.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg00.getOpponentFieldWater());
			Double flatOdds = Double.valueOf(hg00.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死平");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+hg00.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg00.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
			
			jingcaiOdds = Double.valueOf(jingcai2.getOpponentFieldWater());
			hgOdds = Double.valueOf(hg00.getHomeFieldWater());
			flatOdds = Double.valueOf(hg00.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死平");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+hg00.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg00.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai2!=null&&hg00!=null&&hg05!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai2.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg05.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(hg00.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死平");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+hg00.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai1!=null&&hg05!=null&&jsq1!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg05.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jsq1.getHomeFieldWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死平");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("H "+jsq1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getSsTwo(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai2=null;
		EventPlateDoubleToOneDetailInfos hg0=null;
		EventPlateDoubleToOneDetailInfos hg05=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai2 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0**")) {
				hg0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5")) {
				hg05 = odds;
			}
		}
		if(jingcai1==null&&jingcai2==null) return results;
		if(hg0==null&&hg05==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai2!=null&&hg0!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai2.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg0.getHomeFieldWater());
			Double flatOdds = Double.valueOf(jingcai2.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死2");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg0.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai2!=null&&hg05!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai2.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg05.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai2.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死2");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai1!=null&&hg05!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg05.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死2");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat(reword/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getPsOne(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai2=null;
		EventPlateDoubleToOneDetailInfos hg1=null;
		EventPlateDoubleToOneDetailInfos hg2=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-2**")) {
				jingcai2 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("2")) {
				hg2 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("1")) {
				hg1 = odds;
			}
		}
		if(jingcai2==null&&jingcai1==null) return results;
		if(jingcai2!=null && hg2!=null) {
			EventHedgeProfitsDoubleToSingle result;
			Double jingcaiOdds = Double.valueOf(jingcai2.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg2.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai2.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("平手1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg2.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat((reword-result.getBetMoneyPeriphery()+result.getBetMoneyPeriphery()*0.023)/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
			
			jingcaiOdds = Double.valueOf(jingcai2.getOpponentFieldWater());
			hgOdds = Double.valueOf(hg2.getHomeFieldWater())+1;
			flatOdds = Double.valueOf(jingcai2.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("平手1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg2.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat((reword-result.getBetMoneyPeriphery()+result.getBetMoneyPeriphery()*0.023)/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		
		if(jingcai1!=null && hg1!=null) {
			EventHedgeProfitsDoubleToSingle result;
			Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg1.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("平手1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg1.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat((reword-result.getBetMoneyPeriphery()+result.getBetMoneyPeriphery()*0.023)/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
			
			jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			hgOdds = Double.valueOf(hg1.getHomeFieldWater())+1;
			flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("平手1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setPeripheryPlateOdds("H "+hg1.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setBetMoneyFlat((reword-result.getBetMoneyPeriphery()+result.getBetMoneyPeriphery()*0.023)/flatOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getPsThree(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jsq1=null;
		EventPlateDoubleToOneDetailInfos hg1=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("净1")) {
				jsq1 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("1")) {
				hg1 = odds;
			}
		}
		if(jingcai1==null||jsq1==null||hg1==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		Double jingcaiOdds = Double.valueOf(jingcai1.getHomeFieldWater());
		Double hgOdds = Double.valueOf(hg1.getOpponentFieldWater())+1;
		Double flatOdds = Double.valueOf(jsq1.getHomeFieldWater());
		result = new EventHedgeProfitsDoubleToSingle();
		result.setType("平手3");
		result.setIsUpdate(false);
		result.setLotteryPlateOdds("主 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setFlatPlateOdds("H "+jsq1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setPeripheryPlateOdds("H "+hg1.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setHomeField(doubleBill.getHomeField());
		result.setLeagueName(doubleBill.getLeagueName());
		result.setOpponentField(doubleBill.getOpponentField());
		result.setSerialNumber(doubleBill.getSerialNumber());
		result.setBetMoneyJingCai(10000d);
		result.setBetMoneyWinLose(10000d);
		Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
		result.setBetMoneyPeriphery(reword/hgOdds);
		result.setBetMoneyFlat((hgOdds*result.getBetMoneyPeriphery()-result.getBetMoneyPeriphery())/flatOdds+800);
		result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
		result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
		result.setProfit(result.getIncome1()-result.getTotalExpense());
		result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
		result.setProfitLotteryPercent(result.getProfitPercent());
		result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
		results.add(result);
		
		jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
		hgOdds = Double.valueOf(hg1.getHomeFieldWater())+1;
		flatOdds = Double.valueOf(jsq1.getHomeFieldWater());
		result = new EventHedgeProfitsDoubleToSingle();
		result.setType("平手3");
		result.setIsUpdate(false);
		result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setFlatPlateOdds("H "+jsq1.getPlate()+"："+new BigDecimal(String.valueOf(flatOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setPeripheryPlateOdds("H "+hg1.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
		result.setHomeField(doubleBill.getHomeField());
		result.setLeagueName(doubleBill.getLeagueName());
		result.setOpponentField(doubleBill.getOpponentField());
		result.setSerialNumber(doubleBill.getSerialNumber());
		result.setBetMoneyJingCai(10000d);
		result.setBetMoneyWinLose(10000d);
		reword = result.getBetMoneyWinLose()*jingcaiOdds;
		result.setBetMoneyPeriphery(reword/hgOdds);
		result.setBetMoneyFlat((hgOdds*result.getBetMoneyPeriphery()-result.getBetMoneyPeriphery())/flatOdds+800);
		result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
		result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery()+result.getBetMoneyFlat());
		result.setProfit(result.getIncome1()-result.getTotalExpense());
		result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
		result.setProfitLotteryPercent(result.getProfitPercent());
		result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
		results.add(result);
		return results;
	}
	
	private static List<EventHedgeProfitsDoubleToSingle> getSsOne(DoubleBill doubleBill){
		List<EventHedgeProfitsDoubleToSingle> results = new ArrayList<>();
		List<EventPlateDoubleToOneDetailInfos> EventPlateDoubleToOneDetailInfos = doubleBill.getEventPlateDoubleToOneDetailInfos();
		EventPlateDoubleToOneDetailInfos jingcai1=null;
		EventPlateDoubleToOneDetailInfos jingcai2=null;
		EventPlateDoubleToOneDetailInfos hg0=null;
		EventPlateDoubleToOneDetailInfos hg05=null;
		EventPlateDoubleToOneDetailInfos odds;
		for(int i=0; i<EventPlateDoubleToOneDetailInfos.size(); i++) {
			odds = EventPlateDoubleToOneDetailInfos.get(i);
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("-1**")) {
				jingcai1 = odds;
			}
			if(odds.getWebsite().endsWith("竞彩")&&odds.getPlate().equals("0**")) {
				jingcai2 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0**")) {
				hg0 = odds;
			}
			if(odds.getWebsite().endsWith("HG")&&odds.getPlate().equals("0.5")) {
				hg05 = odds;
			}
		}
		if(jingcai1==null&&jingcai2==null) return results;
		if(hg0==null&&hg05==null) return results;
		EventHedgeProfitsDoubleToSingle result;
		if(jingcai1!=null&&hg0!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg0.getHomeFieldWater());
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("");
			result.setPeripheryPlateOdds("H "+hg0.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyFlat(0d);
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai1!=null&&hg05!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai1.getOpponentFieldWater());
			Double hgOdds = Double.valueOf(hg05.getHomeFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai1.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("客 J "+jingcai1.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("");
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyFlat(0d);
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		if(jingcai2!=null&&hg05!=null) {
			Double jingcaiOdds = Double.valueOf(jingcai2.getHomeFieldWater());
			Double hgOdds = Double.valueOf(hg05.getOpponentFieldWater())+1;
			Double flatOdds = Double.valueOf(jingcai2.getFlatWater());
			result = new EventHedgeProfitsDoubleToSingle();
			result.setType("生死1");
			result.setIsUpdate(false);
			result.setLotteryPlateOdds("主 J "+jingcai2.getPlate()+"："+new BigDecimal(String.valueOf(jingcaiOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setFlatPlateOdds("");
			result.setPeripheryPlateOdds("H "+hg05.getPlate()+"："+new BigDecimal(String.valueOf(hgOdds)).setScale(2, RoundingMode.HALF_UP));
			result.setHomeField(doubleBill.getHomeField());
			result.setLeagueName(doubleBill.getLeagueName());
			result.setOpponentField(doubleBill.getOpponentField());
			result.setSerialNumber(doubleBill.getSerialNumber());
			result.setBetMoneyFlat(0d);
			result.setBetMoneyJingCai(10000d);
			result.setBetMoneyWinLose(10000d);
			Double reword = result.getBetMoneyWinLose()*jingcaiOdds;
			result.setBetMoneyPeriphery(reword/hgOdds);
			result.setIncome1(reword+result.getBetMoneyPeriphery()*0.023);
			result.setTotalExpense(result.getBetMoneyWinLose()+result.getBetMoneyPeriphery());
			result.setProfit(result.getIncome1()-result.getTotalExpense());
			result.setProfitPercent(result.getProfit()/result.getBetMoneyWinLose());
			result.setProfitLotteryPercent(result.getProfitPercent());
			result.setRewordReturn(getRewordReturn(jingcaiOdds, result.getType(), hgOdds, flatOdds));
			results.add(result);
		}
		return results;
	}
}
